package com.android.lovely.api.service

import com.android.lovely.api.manager.HttpManager
import com.android.lovely.data.GeneratedImageResult
import com.android.lovely.data.ImageGenerateData
import com.android.lovely.data.ImageGenerationTask
import com.android.lovely.data.ParamList
import com.android.lovely.data.SmartRole
import okhttp3.MultipartBody
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Url

val taskService = HttpManager.createApi<TaskService>()

val generateService = HttpManager.createGenerateApi<TaskService>()

interface TaskService {

    @POST("task/role_info_by_ai")
    suspend fun quickGenerate(@Body params: Map<String, @JvmSuppressWildcards Any>): Map<String, SmartRole>

    @POST("task/get_image_task_param")
    suspend fun getGenerateData(): ImageGenerateData

    @POST("task/post_image_task")
    suspend fun generateImage(@Body body: RequestBody): Response<ResponseBody>

    @Multipart
    @POST
    suspend fun generateImage(
        @Part file: MultipartBody.Part, @Url url: String
    ): Response<ResponseBody>

    @POST("task/get_random_param")
    suspend fun randomGenerateOption(@Body params: Map<String, Int>): ParamList
//
    @POST("task/get_list")
    suspend fun getImageTasks(@Body params: Map<String, Int?>): List<ImageGenerationTask>
//
    @POST("task/get_detail")
    suspend fun getTaskDetails(@Body params: Map<String, Int>): GeneratedImageResult

    @POST("task/delete")
    suspend fun deleteImageTask(@Body params: Map<String, Int>): Any
}